Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hw04 done #36

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

hw04 done #36

wants to merge 1 commit into from

Conversation

Leo-AO-99
Copy link

os: windows store下的Ubuntu20.04
gcc version: 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
初始运行时间:1220ms
优化:
1. -ffast-math -march=native
2. SOA替换AOS
3. 循环的i修改为size_t
4. 使用std下的数学函数
5. 乘法替换除法
6. 热代码计算部分的常量都提前计算好再放入循环中
7. #pragma GCC unroll 效果不大
最终优化时间:128ms

在修改后的代码基础上,只修改Star,修改为std::array,速度就变为700+ms了,没做详细研究

感谢小彭老师,年轻人的第一次优化

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant